<template>
  <div class="audit" style="background-color: rgb(250, 250, 250);height:100%;widyh:100%;position:relative">
    <img src="../../src/img/神里凌人.jpg" alt="">
    <p>企业名称:<span>{{data[0].companName}}</span></p>
    <p>行业:<span>{{data[0].industry}}</span></p>
    <p>规模:<span>{{data[0].count}}</span></p>
    <p>地址:<span>{{data[0].address}}</span></p>
    <p>职位发布人:<span>{{data[0].postPublisher}}</span></p>
    <p>职位:<span>{{data[0].position}}</span></p>
    <p style="display:flex">资质: <img src="https://dummyimage.com/200x200/dbd7d7/e3e3e3.jpg&text=    " alt="">
    <img src="https://dummyimage.com/200x200/dbd7d7/e3e3e3.jpg&text=    " alt="">
    <img src="https://dummyimage.com/200x200/dbd7d7/e3e3e3.jpg&text=    " alt=""></p>
    <a-button type="danger" shape="round"  style="margin-right:200px;margin-left:150px;margin-top:50px"><router-link to="/Audit/pop">驳回</router-link> </a-button>
    <a-button type="primary" shape="round"><router-link to="/Audit">通过</router-link> </a-button>
  </div>
</template>

<script>
const columns = [
  {
    title: "",
    dataIndex: "postPublisher",
    key: "name",
    width:"8%",
    scopedSlots: { customRender: "name" },
  },
  {
    title: "公司",
    dataIndex: "companName",
    key: "age",
    width:"10%",
  },
  {
    title: "行业",
    dataIndex: "industry",
    key: "address 4",
    width:"10%",
    ellipsis: true,
  },
  {
    title: "规模",
    dataIndex: "count",
    key: "address 2",
    width:"10%",
    ellipsis: true,
  },
  {
    title: "地址",
    dataIndex: "address",
    width:"15%",
    key: "address 1",
    ellipsis: true,
  }
  ,
  {
    title: "职位",
    dataIndex: "position",
    key: "address 4",
    ellipsis: true,
  },
  {
    title: "注册时间",
    dataIndex: "registerTime",
    key: "address 4",
    ellipsis: true,
  },
  {
    title: "最近登录时间",
    dataIndex: "recentLoginTime",
    key: "address 3",
    ellipsis: true,
  },
];

const data = [];
// const data = [
//   {
//     key: '1',
//     name: 'John Brown',
//     age: 32,
//     address: 'New York No. 1 Lake Park, New York No. 1 Lake Park',
//     tags: ['nice', 'developer'],
//   }
// ];
export default {
  data() {
    return {
      data,
      columns,
    };
  },
  mounted() {
      function getData(url){
        return new Promise((resolve,reject)=>{
            const xhr=new XMLHttpRequest();
            xhr.open('post',url);
            xhr.setRequestHeader('content-type','application/JSON')
            xhr.send();
            xhr.onreadystatechange=function(){
                if(xhr.readyState===4){
                    if(xhr.status===200){
                        resolve(xhr.responseText);
                    }
                }else{
                  console.log(reject);
                }
            };
        });
    }
    //async与await是组合搭配，只要一个没存在就会报错//无法把里面的数据拿到外部,会自动获取结果,省去了之后的then请求结果
    async function action(){
        const dataInfo=await getData('/getcompanyinfo');//使用这个方法更便捷，省去了之后的then请求结果，原本是then去执行这个请求，await等待结果,await===.then(cb){}
        const dataDel=await JSON.parse(dataInfo).data[0];
        console.log(dataDel);
        data.push({
          key: "1",
          companName: dataDel.userAllInfo.companyDetail.companName,
          industry: dataDel.userAllInfo.companyDetail.industry,
          address: dataDel.userAllInfo.companyDetail.address,
          count: dataDel.userAllInfo.companyDetail.count,
          recentLoginTime: dataDel.userAllInfo.companyDetail.recentLoginTime,
          registerTime: dataDel.userAllInfo.companyDetail.registerTime,
          position: dataDel.userAllInfo.companyDetail.position,
          postPublisher: dataDel.userAllInfo.companyDetail.postPublisher,
          hirings: dataDel.userAllInfo.companyDetail.hirings,

        });
        console.log(data[0].hirings);
        return dataDel;
    }
    action()
    console.log(data);
  },
  methods: {
    submit() {
      console.log(123);
    },
  },
};
</script>

<style>
img{
  height: 60px;
  /* display: inline-block; */
  border-radius: 50%;
  width: 60px;
}

.audit p{
    margin-left: 50px;
}

.audit span{
    position: absolute;
    left: 200px;
    font-weight: 550;
}

p img{ 
    margin-left:50px;
    width:200px;
    height:200px;
    border-radius: 0;
}
</style>